using System.Collections.Generic;

namespace UFrame
{
    public class ExcelRead : IExcelTool
    {
        void IExcelTool.ParseExcel<T>(string assetName, IDictionary<int, T> configDic)
        {
#if Excel
            var list = ExcelHelper.GetAllRow<T>(assetName, typeof(T).FullName);
            foreach (var item in list)
            {
                Type type = item.GetType();
                var field = type.GetField("id");
                int id = (int) field.GetValue(item);
                if (configDic.ContainsKey(id))
                {
                    Debug.LogError("重复Id" + id);
                }
                else
                {
                    configDic.Add(id, item);
                }
            }
#endif
        }
    }
}
